<template>
	<!-- 自我介绍页面 -->
	<view class="textarea_box">
		<textarea class="textarea" placeholder="还没有简介哦,介绍一下自己吧." maxlength="100" v-model="desc" />
		<view class="num">{{ desc.length }}/100</view>
		<view class="save" @tap="save">
			保存
		</view>
	</view>
</template>

<script>
	export default {
		data(){
			return {
				desc: ''
			}
		},
		onLoad(option) {
			if(option.text){
				this.desc = option.text
			}
			const that = this
			uni.getStorage({
			    key: 'zwjs',
			    success: function (res) {
			        that.desc = res.data
			    }
			});
		},
		methods: {
			save(){
				uni.navigateBack({
					delta:1
				})
				uni.setStorage({
					key: 'zwjs',
					data: this.desc,
					success: function () {
					    console.log('success');
					}
				})
			}
		}
	}
</script>

<style lang="less" scoped>
	.textarea_box {
		padding: 71rpx 32rpx 0 32rpx;
		.num {
			text-align: right;
			font-size: 28rpx;
			color: #999999;
		}
		.save {
			height: 86rpx;
			background-color: #2168EB;
			font-size: 30rpx;
			color: #ffffff;
			text-align: center;
			line-height: 86rpx;
			border-radius: 43rpx;
			margin-top: 40rpx;
		}
	}
</style>
